<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./js/jquery-1.8.3.min.js"></script>
    <script src="./js/common.js"></script>
</head>
<body>
typeList
<hr>
<a href="login.html">登录</a><br>
<a href="productList.html">查看所有商品</a>
<table border="1" id="tab">
    <tr>
        <td>TypeId</td>
        <td>TypeName</td>
    </tr>
</table>
</body>
</html>

<script>
    $(function () {
        $.ajax({
            url: "type/findAll",
            type: "get",
            dataType: "json",
            success: function (resp) {
                // console.log(resp.state);
                // console.log(resp.data.length);
                var typeList = resp.data;
                if(resp.state == "success"){
                    for(var i=0; i<typeList.length; i++)
                    $("#tab").append(
                        "<tr>" +
                            "<td>"+typeList[i].typeId+"</td>"+
                            "<td><a href='productInfo.html?typeId="+typeList[i].typeId+"'>"+typeList[i].typeName+"</a></td>"+
                        "</tr>"
                    )
                }
            }
        })
    })
</script>